<?php

namespace App\Providers;

use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        // 登录事件及对应监听器
        'App\Events\V1\AdminLoginEvent' => [
            'App\Listeners\V1\LoginLogListener',
        ],
        // 忘记密码事件及对应监听器
        'App\Events\V1\ForgotPasswordEvent' => [
            'App\Listeners\V1\ForgotPasswordLogListener',
        ],
        // 文件上传事件及对应监听器
        'App\Events\V1\UploadFileEvent' => [
            'App\Listeners\V1\UploadAvatarLogListener',
        ],
        // 文件导入导出事件及对应监听器
        'App\Events\V1\ImportExportEvent' => [
            'App\Listeners\V1\ImportExportLogListener'
        ],
        //创建token
        'Laravel\Passport\Events\AccessTokenCreated' => [
            'App\Listeners\RevokeOldAccessTokensListener',
        ],
        // 刷新token
        'Laravel\Passport\Events\RefreshTokenCreated' => [
            'App\Listeners\RevokeOldRefreshTokensListener',
        ],
    ];

    /**
     * Register any events for your application.
     *
     * @return void
     */
    public function boot()
    {
        parent::boot();

        //
    }
}
